<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>测试zzl-plug.js</title>
</head>
<script></script>
<body>
//1.基本类型 用typeof
//2.引用类型用   toString
var class2type ={};

//生成对象映射
"Boolean Number String Function Array Date RegExp Object Error Null Undefined".split(" ").map(
function (item,index) {
class2type["[object "+item+"]"]=item.toLowerCase();
}
);
function type(obj) {
if(obj==null){
return obj +"";
}
return typeof obj==='object'||typeof obj==='function'?class2type[Object.
prototype.toString.call(obj)] ||
'object': typeof obj;
}

function  isFunction(obj) {
return type(obj)==='function';
}
var abc =function () {

}
//测试
var reg =/a/g;
console.info(type(reg));
console.info(type(1));
console.info(type());
console.info(isFunction(abc));
console.info($);

//每一个对象都有_proto_
//函数对象prototype

//Function 本地构造函数
//Object 本地构造函数
console.info(Object instanceof Function);//true
console.info(Function instanceof Object);//true

//函数对象-》Function.prototype->function(){}->Object.prototype
</body>
</html>